package homework;
import java.util.Scanner;
public class test2 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入存入金额：(1000起存)");
        double depositAmount = scan.nextDouble();
        System.out.print("请输入存入年限：(一年、两年、三年、五年)");
        int depositPeriod = scan.nextInt();
        double annualInterestRate = 0 ;
        if (depositPeriod == 1) {
            annualInterestRate = 2.25 * 0.01;
        } else if (depositPeriod == 2) {
            annualInterestRate = 2.7 * 0.01;
        } else if (depositPeriod == 3) {
            annualInterestRate = 3.25 * 0.01;
        } else if (depositPeriod == 5) {
            annualInterestRate = 3.6 * 0.01;
        } else {
            System.out.println("输入的年限有误");
        }
        double principalAndInterestAmount = depositAmount + depositAmount * annualInterestRate * depositPeriod;
        System.out.println("存款"+depositPeriod+"年后本息金额为："+ principalAndInterestAmount);
    }
}
